﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;
using System.Data;
using System.Collections;

public partial class Periodicalist : System.Web.UI.Page
{
   // Dictionary<string, string> d = new Dictionary<string, string>();
    //Dictionary<string, string> old= new Dictionary<string, string>();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // ViewState.Add("myitems", d);
            // ViewState.Add("olditems", d);

            // //DB.DELETE("company_product", "int,company_id," + Session["company_id"].ToString());  
            //adjustclient(int.Parse( Session["company_id"].ToString()));
        }
    }
   
    
    protected override void InitializeCulture()
    {
        if (Session["CurrentCulture"] != null)
        {
            string lang = Session["CurrentCulture"].ToString();
            if (lang != null && lang != "")
            {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);
                Thread.CurrentThread.CurrentCulture.DateTimeFormat = new CultureInfo("en-US", false).DateTimeFormat;
                // Thread.CurrentThread.CurrentCulture.Calendar=new  System.Globalization.GregorianCalendar();

            }
        }

    }
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
      
        //if (e.Row.RowType == DataControlRowType.DataRow)
        //{
        //    e.Row.Attributes.Add("onmouseover", "this.Mystyle=this.style.backgroundColor;this.style.backgroundColor='#FFFFA8'");

        //    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.Mystyle");
        //}
    }


    protected void searchfield_TextChanged(object sender, EventArgs e)
    {
        SqlDataSource1.SelectCommand += " and product  LIKE '" + searchfield.Text + "%'";
        GridView1.DataBind();

    }

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            CheckBox vv = (CheckBox)e.Row.FindControl("chkAdd");

            if (DateTime.Parse(vv.ToolTip) >= DateTime.Now)
            {
                vv.Checked = true;
            
            }


        }
    }
    protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if(RadioButtonList1.SelectedValue=="0")
        {
            SqlDataSource1.SelectCommand += " and tt.enddate <getdate()";
        }
        else
        {
            SqlDataSource1.SelectCommand += " and tt.enddate >=getdate()";

        }
        GridView1.DataBind();
    }
}
